<include file="public@header"/>
</head>
<body>
<div class="layui-fluid js-check-wrap">
    <form action="{:url('AdminCategory/editPost')}" method="post" class="layui-form js-ajax-form margin-top-20">
        <div class="layui-card">
            <div class="layui-card-header">{:lang('PORTAL_ADMINCATEGORY_EDIT')}</div>
            <div class="layui-card-body">
                <div class="layui-tab">
                    <ul class="layui-tab-title">
                        <li class="layui-this">
                            <span class="icon-wrapper"><i class="fa fa-align-center"></i></span>
                            <span class="text-wrapper">{:lang('GENERAL_SETTING')}</span>
                        </li>
                        <li>
                            <span class="icon-wrapper"><i class="fa fa-cog"></i></span>
                            <span class="text-wrapper">{:lang('SEO_OPT')}</span>
                        </li>
                        <li>
                            <span class="icon-wrapper"><i class="fa fa-file"></i></span>
                            <span class="text-wrapper">{:lang('TEMPLATE_SETTING')}</span>
                        </li>
                        <li>
                            <span class="icon-wrapper"><i class="fa fa-image"></i></span>
                            <span class="text-wrapper">{:lang('PICTURE_SETTING')}</span>
                        </li>
                    </ul>
                    
                    <div class="layui-tab-content">
                        <div class="layui-tab-item layui-show">
                            <div class="layui-card-body">
                                <!-- 上级分类 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('TOP_CATEGORY')}</label>
                                    <div class="layui-input-block">
                                        
                                        <select class="layui-input" name="parent_id" id="input-parent">
                                            <option value="0">{:lang('FIRST_CATEGORY')}</option>
                                            {$categories_tree}
                                        </select>
                                    </div>
                                </div>
                                <!-- 分类名称 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('CATEGORY_NAME')}</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" id="input-name" name="name" value="{$name}">
                                    </div>
                                </div>

                                <!-- 副分类名称 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('CATEGORY_SUBNAME')}</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" id="input-subname" name="subname" value="{$subname}">
                                    </div>
                                </div>

                                <!-- 分类别名 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('CATEGORY_ALIAS')}</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" id="input-alias" name="alias"
                                               value="{$alias|default=''}">
                                    </div>
                                </div>

                                <!-- <div class="layui-form-item">
                                    <label for="input-name">分类类型</label>
                                    <div>
                                        <select class="layui-input" name="taxonomy">
                                            {$taxonomys}
                                        </select>
                                    </div>
                                </div> -->

                                <!-- 分类描述 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('CATEGORY_DESCRIPTION')}</label>
                                    <div class="layui-input-block">
                                        <!-- <textarea class="layui-textarea" name="description" rows="5" placeholder="">{$description}</textarea> -->
                                        <script type="text/plain" id="input-description" name="description">{$description}</script>
                                    </div>
                                </div>
                                <!-- 审核流程 -->
                                <!-- <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('AUDIT_PROCESS')}</label>
                                    <div class="layui-input-block">
                                        <select class="layui-input" name="audit_id" id="input-parent">
                                            <option value="0">{:lang('SELECT_PLEASE')}</option>
                                            {$audit_list}
                                        </select>
                                    </div>
                                </div> -->
                                <!-- 排序号 -->
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('SORT')}</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" name="list_order" value="{$list_order}">
                                    </div>
                                </div>
                                <!-- 属性 -->
                                <div class="layui-form-item">
                                    <php>
                                        $is_show_yes = ($is_show == 0) ? "checked" : "";
                                    </php>
                                    <label class="layui-form-label">{:lang('ATTRIBUTE')}</label>
                                    <div class="layui-input-block">
                                        <input type="checkbox" name="is_show" title="{:lang('IS_HIDE')}" value="0" {$is_show_yes}>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-card-body">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_TITLE')}</label>
                                    <div class="layui-input-block">
                                        <input class="layui-input" type="text" name="page_title"
                                               value="{$page_title}" placeholder="{:lang('PLEASE_ENTER')}{:lang('PAGE_TITLE')}">
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_KEYWORDS')}</label>
                                        <div class="layui-input-block">
                                            <input class="layui-input" type="text" name="page_keywords"
                                                   value="{$page_keywords}" placeholder="{:lang('PLEASE_ENTER')}{:lang('PAGE_KEYWORDS')}">
                                        </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PAGE_DESCRIPTION')}</label>
                                    <div class="layui-input-block">
                                        <textarea class="layui-textarea" name="page_description" rows="5"
                                                  placeholder="{:lang('PLEASE_FILL_IN')}{:lang('PAGE_DESCRIPTION')}">{$page_description}</textarea>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-card-body">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('LIST_TEMPLATE')}</label>
                                    <div class="layui-input-block">
                                        <select class="layui-input" name="list_tpl" id="input-list_tpl">
                                            <!-- <option value="list">portal/list.html(默认)</option> -->
                                            <foreach name="list_theme_files" item="vo">
                                                <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('ARTICLE_TEMPLATE')}</label>
                                    <div class="layui-input-block">
                                        <select class="layui-input" name="one_tpl" id="input-one_tpl">
                                            <!--<option value="article">portal/article.html(默认)</option>-->
                                            <foreach name="article_theme_files" item="vo">
                                                <php>$value=preg_replace('/^portal\//','',$vo['file']);</php>
                                                <option value="{$value}">{$vo.name} {$vo.file}.html</option>
                                            </foreach>
                                        </select>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-tab-item">
                            <div class="layui-card-body">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('UPLOAD_IMAGE')}</label>
                                    <div class="layui-input-block">
                                        <input type="hidden" name="more[thumbnail]" class="layui-input" value="{$more.thumbnail|default=''}" id="thumbnail">

                                        <a href="javascript:uploadOneImage('{:lang('UPLOAD_IMAGE')}','#thumbnail');">
                                            <if condition="empty($more.thumbnail)">
                                                <img src="__TMPL__/public/assets/images/default-thumbnail.png"
                                                     id="thumbnail-preview"
                                                     width="150"/>
                                                <else/>
                                                <img src="{:cmf_get_image_preview_url($more.thumbnail)}"
                                                     id="thumbnail-preview"
                                                width="150"/>
                                            </if>
                                        </a>
                                        <input type="button" class="layui-btn layui-btn-danger layui-btn-sm" onclick="$('#thumbnail-preview').attr('src','__TMPL__/public/assets/images/default-thumbnail.png');$('#thumbnail').val('');return false;" value="{:lang('CANCEL_PICTURE')}">
                                        <br>
                                        <eq name="parent_id" value="46">
                                            <p class="layui-word-aux">推荐尺寸 692px * 349px</p>
                                        </eq>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('BANNER_PICTURE')}</label>
                                    <div class="layui-input-block">
                                        <select class="layui-input" name="slide_id">
                                            <option value="0">{:lang('SELECT_PLEASE')}</option>
                                            <foreach name="slide" item="vo">
                                                <php>$cid_selected=$slide_id==$vo['id']?"selected":"";</php>
                                                <option value="{$vo.id}"{$cid_selected}>{$vo.name}</option>
                                            </foreach>
                                        </select>
                                        <span class="layui-word-aux">可前往幻灯片管理进行添加</span>
                                    </div>
                                </div>

                                <div class="layui-form-item">
                                    <label class="layui-form-label">{:lang('PICTURE_RECOMMENDED_SIZE')}</label>
                                    <div class="layui-input-block">
                                        <input type="text" class="layui-input" id="input-thumb_size" name="thumb_size" value="{$thumb_size}">
                                        <span class="layui-word-aux">该分类下的文章图片推荐尺寸</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="layui-form-item padding-left-25">
                    <div class="layui-input-block">
                        <input type="hidden" name="id" value="{$id}">
                        <button type="submit" class="layui-btn layui-btn-normal js-ajax-submit" data-refresh="0">{:lang('SAVE')}</button>
                        <a class="layui-btn layui-btn-primary" href="{:url('AdminCategory/index')}">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>

<include file="public@footer"/>

<script type="text/javascript">
    //编辑器路径定义
    var editorURL = GV.WEB_ROOT;
</script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.js"></script>
<script type="text/javascript">
    $('#input-list_tpl').val("{$list_tpl|default=''}");
    $('#input-one_tpl').val("{$one_tpl|default=''}");
    $(function () {
        //编辑器
        if( $('#input-description').length ){
            var editor = UE.getEditor('input-description',{  
                //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个  
                toolbars:[['fullscreen', 'source', 'undo', 'redo', 'bold', 'italic', 'underline', 'fontborder', 'backcolor', 'fontsize', 'fontfamily', 'justifyleft', 'justifyright', 'justifycenter', 'justifyjustify', 'strikethrough', 'removeformat', 'autotypeset', 'pasteplain', '|', 'forecolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc', 'link', 'unlink']],
                //关闭字数统计  
                wordCount:false,  
                //关闭elementPath  
                elementPathEnabled:false,  
                //默认的编辑区域高度  
                initialFrameHeight:200,
                initialFrameWidth:'100%',
            });
        }

    });
</script>
